<?php 
/**
 * Main index page. Displays the announcement message if configured, and some statistic graph for signals.
 *
 * @package   views
 * @subpackage site
 * @since     1.0
 * @filesource
 */

$this->pageTitle=Yii::app()->name; ?>

<h1>Welcome to <i><?php echo CHtml::encode(Yii::app()->name); ?></i></h1>
<?php 
$announcement=GlobalConfiguration::getByKey('ANNOUNCEMENT_MESSAGE');
if($announcement){
	?>
	<div class="announcement"><?php echo $announcement;?></div>
	<?php
}
?>


<?php  if(isset($viewableOrganizations)){ ?>
<div id="signal-summary">
<h2>Signals Summary by Organization</h2>
View Summary for: 
<?php 
$signalUrl=$this->createUrl('patientSignal/index');
$separator=strstr($signalUrl, '?')?'&':'?';
echo CHtml::dropDownList('organizationId',$organization->id,
				CHtml::listData($viewableOrganizations, 'id', 'name'),
				array('style'=>'width:300px;','id'=>'organizationId','onchange'=>"window.location.href='?organizationId='+this.value"));
echo CHtml::submitButton("Search",array('onclick'=>"window.location.href='".$signalUrl.$separator."PatientSignalSearch[organizationId]='+$('#organizationId').val();return false;"));
$this->widget('ext.cvisualizewidget.CVisualizeWidget',array(
    'data'=>array(
        'headings'=>$organizationSummary['disorders'],
        'data'=>array(
            'Female' => $organizationSummary['female'],
            'Male' => $organizationSummary['male'],
        )
    ),
    'type'=>'bar',
    'options' => array(
        'title'=>'Signal Files Summary for '.$organization->name,
        'width'=>760,
        'height'=>250
    )
));
?>
</div>
<?php } ?>
